package kr.hkit.summary_java.log;

import java.sql.Connection;
import java.sql.SQLException;

import kr.hkit.myframework.db.ConnectionFactory;
import kr.hkit.myframework.db.DBProperties;
import kr.hkit.summary_java.erp.dao.DaoInterface;
import kr.hkit.summary_java.erp.dao.DepartmentDao;
import kr.hkit.summary_java.erp.dto.Department;



public class TestMain {
	public static void main(String[] args) throws SQLException {
		String filePath = "dbcon.xml";
		String driver = "com.mysql.jdbc.Driver";
		String url = "jdbc:mysql://localhost:3306/erp";
		String user = "root";
		String password = "1111";
	
		DBProperties.savePropertis("dbcon.xml", driver, url, user, password);
		DBProperties.prnProperties(DBProperties.loadPropertis(filePath));
	
		Connection con = ConnectionFactory.getConnection();
		
		DaoInterface<Department> dao = new DepartmentDao(con);
		dao.updateItemByNo(new Department(7, "디자인", 77));
		
//		dao.insertItem(new Department(7, "디자인", 11));
		
//		ArrayList<Department> lists = dao.listItems();
//		for ( Department d : lists){
//			System.out.println(d);
//		}
		
		Department dept = new Department();
		dept.setDeptNo(1);
		
		Department temp  = dao.searchItem(dept);
		System.out.println(temp);
		
	}
}
